﻿@using SCMS.Resources
@model SCMS.UI.Models.POItems

@{AjaxOptions ajaxOpts = new AjaxOptions
{
    UpdateTargetId = "PODiv",
    LoadingElementId = "loading",
    HttpMethod = "Post",
    Url = Url.Action("UpdatePOItem"),
    OnBegin = "return checkBLBalance(0)",
    OnSuccess = "CloseDialog"
};}
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<p id="budgetCheckStatus"></p>
@using (Ajax.BeginForm(null, null, ajaxOpts, new { @class = "form" }))
{
    @Html.ValidationSummary(true)
    <h4 style="text-align:center;">@Resources_frank.PurchaseOrder_EditPOItem_UpdatePOItem</h4>
    <table>
        <tr>
            <td align="right">
                <b>@Resources_frank.Global_String_Item:</b>
            </td>
            <td>
                &nbsp;
                @Model.ItemName
                @Html.HiddenFor(model => model.POItemId)
                @Html.HiddenFor(model => model.EntityPOItem.OrderRequestItemId, new { @id = "orItem0" })
                @Html.HiddenFor(model => model.EntityPOItem.PurchaseOrderId)
            </td>
        </tr>
        <tr>
            <td align="right">
                <b>@Resources_frank.Global_String_Description:</b>
            </td>
            <td>
                &nbsp;
                @Model.EntityPOItem.OrderRequestItem.ItemDescription
            </td>
        </tr>
        <tr>
            <td align="right">
                <b>@Resources_morgan.Global_String_Quantity:</b>
            </td>
            <td>
                @Html.TextBoxFor(model => model.Quantity, new { id = "quantity0", onblur = "javascript:computePOItemTotals(0)", @class = "numericTb" })
                @Html.ValidationMessageFor(model => model.Quantity)                
            </td>
        </tr>
        <tr>
            <td align="right">
                <b>@Resources_frank.PurchaseOrder_AddPOItems_UnitPrice:</b>
            </td>
            <td>
                @Html.TextBoxFor(model => model.UnitCost, new { id = "unitPrice0", onblur = "javascript:computePOItemTotals(0)", @class = "numericTb" })
                @Html.ValidationMessageFor(model => model.UnitCost)
            </td>
        </tr>
        <tr>
            <td align="right">
                <b>@Resources_frank.PurchaseOrder_AddPOItems_TotalPrice:</b>
            </td>
            <td>
                @Html.TextBoxFor(model => model.TotalCost, new { id = "totalPrice0", @class = "numericTb", @readonly = "readonly" })
                @Html.ValidationMessageFor(model => model.TotalCost)
            </td>
        </tr>
        <tr id="row0">
            <td align="right">
                <b>@Resources_frank.Budget_CreateSubLine_LineNumber:</b>
            </td>
            <td>
                @Html.DropDownListFor(m => m.BudgetLineId, Model.BudgetLines, new { @id = "blId0", onchange = "javascript:checkBLBalance(0)" })
                @Html.ValidationMessageFor(m => m.BudgetLineId)
            </td>
        </tr>
        <tr>
            <td align="right">
                <b>@Resources_morgan.Global_String_Remarks:</b>
            </td>
            <td>
                @Html.TextBoxFor(model => model.Remarks)
            </td>
        </tr>
        <tr>
            <td align="right">
                
            </td>
            <td>
                <input type="submit" class="btn green" value="@Resources_frank.Global_String_Update" />
                &nbsp;
                <input type="button" class="btn green" value="@Resources_frank.Global_String_Cancel" onclick="CloseDialog()" />
            </td>
        </tr>
    </table>
}